package com.atguigu.lease.web.app.custom.config;

import com.atguigu.lease.interceotors.LoginInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

public class SpringMvcConfigiguration implements WebMvcConfigurer {
    //拦截哪些
    @Value("${login.interceptor.includes}")
    private String [] includes;
    //放行哪些
    @Value("${login.interceptor.excludes}")
    private String [] excludes;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns(includes)
                .excludePathPatterns(excludes)
                .order(10);
    }
}
